//用户列表
import menu from '../config/menu'

export default async (ctx, next) => {
  let res = await ctx.db.querys(`select menulimits from role where roleid='${ctx.info.roleid}'`);
  if (!res.length) {
    ctx.body = { code: 0, msg: '无法查看任何菜单' }
    return
  }
  let data = [];
  let rolemenulimits = JSON.parse(res[0].menulimits);
  rolemenulimits.forEach(item => data.push(menu[item]));
  ctx.body = { code: 1, msg: '角色获取成功', data }
}